void CreateBTree(BTree &BT,string str)
{
    BT=new BTNode;
    BTree s;
    queue<BTree>q;
    int i=0;
    if(str[0]!='#')
    {
        BT->data=str[0];
        q.push(BT);
    }
    else
        BT=NULL;

    while(q.size())
    {
        if(str[++i]=='#')
        {
            q.front()->lchild=NULL;
            //  q.pop();
        }
        else
        {
            s=new BTNode;
            s->data=str[i];
            q.front()->lchild=s;
            q.push(q.front()->lchild);
        }
        if(str[++i]=='#')
        {
            q.front()->rchild=NULL;
            //  q.pop();
        }
        else
        {
            s=new BTNode;
            s->data=str[i];
            q.front()->rchild=s;
            q.push(q.front()->rchild);
        }
        q.pop();
    }
}
void PreOrder( BTree BT )
{
    int flag=0;
    if(BT!=NULL)
    {

        cout<<BT->data;
        if(BT->lchild)
        {
            cout<<" ";
            PreOrder(BT->lchild);
        }

        if (BT->rchild)
        {
            cout<<" ";
            PreOrder(BT->rchild);
        }

    }
}
void InOrder( BTree BT )
{
    if(BT!=NULL)
    {

        InOrder(BT->lchild);
        if(BT->lchild)
        cout<<" ";
        cout<<BT->data;

       if (BT->rchild)
        cout<<" ";
          InOrder(BT->rchild);
    }
}
void PostOrder(BTree bt)
{

    if(bt!=NULL)
    {
        PostOrder(bt->lchild);
        if(bt->lchild)
            cout<<" ";
        PostOrder(bt->rchild);
        if(bt->rchild)
            cout<<" ";
        cout<<bt->data;
    }


}
